
//
//  U9StockAccountManager.m
//  U9WatchGame
//
//  Created by uuu9 on 2018/9/21.
//  Copyright © 2018年 UUU9. All rights reserved.
//

#import "U9StockAccountManager.h"
#import "U9MyInvestListModel.h"
#import "U9GoodsListModel.h"
#import "U9FundListModel.h"
#import "U9MyIncomeModel.h"


@implementation U9StockAccountManager

+ (void)getMyInvestListWithUserid:(NSString *)uid andSessionid:(NSString *)sessionid andCompletionHandle:(void (^)(U9MyInvestListModel *model, NSError *error))complete{
    NSString *param = [NSString stringWithFormat:@"userid=%@&sessionid=%@",uid,sessionid];
    [self EncryptPOST:[NSString stringWithFormat:@"%@%@",Api_URL,kMyInvestList]
    parameters:param
completionHandler:^(id responseObj, NSError *error) {
    U9MyInvestListModel *model = [U9MyInvestListModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    complete(model,error);
}];
}

+ (void)getAccountGoodsListWithCompletionHandle:(void (^)(U9GoodsListModel *model, NSError *error))complete{
    [self POST:[NSString stringWithFormat:@"%@%@",Api_URL,kAccountShopList]
    parameters:nil
completionHandler:^(id responseObj, NSError *error) {
    U9GoodsListModel *model = [U9GoodsListModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    complete(model,error);
}];
}


+ (void)getFundListWithCompletionHandle:(void (^)(U9FundListModel *model, NSError *error))complete{
    [self POST:[NSString stringWithFormat:@"%@%@",Api_URL,kFundList]
    parameters:nil
completionHandler:^(id responseObj, NSError *error) {
    U9FundListModel *model = [U9FundListModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    complete(model,error);
}];
}


+ (void)getMyIncomeWithUserid:(NSString *)uid andSessionid:(NSString *)sessionid andCompletionHandle:(void (^)(U9MyIncomeModel *model, NSError *error))complete{
    NSString *param = [NSString stringWithFormat:@"userid=%@&sessionid=%@",uid,sessionid];
    [self EncryptPOST:[NSString stringWithFormat:@"%@%@",Api_URL,kMyIncome]
    parameters:param
completionHandler:^(id responseObj, NSError *error) {
    U9MyIncomeModel *model = [U9MyIncomeModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    complete(model,error);
}];
}


@end
